#pragma once


#include "qwindow.h"
#include "qtooltip.h"
#include "qimagelist.h"


namespace micro{
namespace gui{



struct QButtonInfo
{
  UINT commandID;
  UINT BitmapResID; //mare
  
  LPCTSTR toolTip;
};


class QToolBar :public QWindow
{
protected:
	QImageList m_imageList;
	int cx, cy;


public:
	
	QToolBar(void);
	virtual ~QToolBar(void);
	bool Create(QWindow* parent);
	void AddButton(QButtonInfo &butInfo, bool showText=false, UINT style = BTNS_BUTTON);
	void SetNotifyWindow(HWND hWnd);
	virtual LPCTSTR GetWndClassName(){	return TOOLBARCLASSNAME;}

public:
	

	  bool GetMaxSize(LPSIZE size)
	  { return  0 != SendMessage(TB_GETMAXSIZE, 0, (LPARAM)size); }

	  bool EnableButton(UINT buttonID, bool enable)
	  { 
		   return    0 != SendMessage(TB_ENABLEBUTTON, buttonID, MAKELONG( enable,0)   ); 
	  }
	  void SetStructSize() 
	  { 
		  SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON)); 
		  //SendMessage( TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
	  }

	  HIMAGELIST SetImageList(UINT listIndex, HIMAGELIST imageList)
	  { return HIMAGELIST(SendMessage(TB_SETIMAGELIST, listIndex, (LPARAM)imageList)); }
	  
	  BOOL  AddButton(UINT numButtons, LPTBBUTTON buttons)
	  { return    SendMessage(TB_ADDBUTTONS, numButtons, (LPARAM)buttons ); }
  

	BOOL IsButtonEnabled(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ISBUTTONENABLED, nID, 0L);
	}

	BOOL IsButtonChecked(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ISBUTTONCHECKED, nID, 0L);
	}

	BOOL IsButtonPressed(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ISBUTTONPRESSED, nID, 0L);
	}

	BOOL IsButtonHidden(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return(BOOL) ::SendMessage(_window, TB_ISBUTTONHIDDEN, nID, 0L);
	}

	BOOL IsButtonIndeterminate(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ISBUTTONINDETERMINATE, nID, 0L);
	}

	int GetState(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETSTATE, nID, 0L);
	}

	BOOL SetState(int nID, UINT nState)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETSTATE, nID, MAKELPARAM(nState, 0));
	}

	BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETBUTTON, nIndex, (LPARAM)lpButton);
	}

	int GetButtonCount() const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_BUTTONCOUNT, 0, 0L);
	}

	BOOL GetItemRect(int nIndex, LPRECT lpRect) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETITEMRECT, nIndex, (LPARAM)lpRect);
	}

	void SetButtonStructSize(int nSize = sizeof(TBBUTTON))
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_BUTTONSTRUCTSIZE, nSize, 0L);
	}

	BOOL SetButtonSize(SIZE size)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy));
	}

	BOOL SetButtonSize(int cx, int cy)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy));
	}

	BOOL SetBitmapSize(SIZE size)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy));
	}

	BOOL SetBitmapSize(int cx, int cy)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy));
	}

#ifndef _WIN32_WCE
	QToolTip GetToolTips() const
	{
		ASSERT(::IsWindow(_window));
		return QToolTip((HWND)::SendMessage(_window, TB_GETTOOLTIPS, 0, 0L));
	}

	void SetToolTips(HWND hWndToolTip)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L);
	}
#endif // !_WIN32_WCE

	 

	int GetRows() const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETROWS, 0, 0L);
	}

	void SetRows(int nRows, BOOL bLarger, LPRECT lpRect)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect);
	}

	BOOL SetCmdID(int nIndex, UINT nID)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETCMDID, nIndex, nID);
	}

	DWORD GetBitmapFlags() const
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_GETBITMAPFLAGS, 0, 0L);
	}

	int GetBitmap(int nID) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETBITMAP, nID, 0L);
	}

	int GetButtonText(int nID, LPTSTR lpstrText) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText);
	}

	// nIndex - IE5 or higher only
	QImageList GetImageList(int nIndex = 0) const
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_GETIMAGELIST, nIndex, 0L));
	}

	// nIndex - IE5 or higher only
	QImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0)
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList));
	}

	// nIndex - IE5 or higher only
	QImageList GetDisabledImageList(int nIndex = 0) const
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_GETDISABLEDIMAGELIST, nIndex, 0L));
	}

	// nIndex - IE5 or higher only
	QImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0)
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList));
	}

#ifndef _WIN32_WCE
	// nIndex - IE5 or higher only
	QImageList GetHotImageList(int nIndex = 0) const
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_GETHOTIMAGELIST, nIndex, 0L));
	}

	// nIndex - IE5 or higher only
	QImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0)
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList));
	}
#endif // !_WIN32_WCE

	DWORD GetStyle() const
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_GETSTYLE, 0, 0L);
	}

	void SetStyle(DWORD dwStyle)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETSTYLE, 0, dwStyle);
	}

	DWORD GetButtonSize() const
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_GETBUTTONSIZE, 0, 0L);
	}

	void GetButtonSize(SIZE& size) const
	{
		ASSERT(::IsWindow(_window));
		DWORD dwRet = (DWORD)::SendMessage(_window, TB_GETBUTTONSIZE, 0, 0L);
		size.cx = LOWORD(dwRet);
		size.cy = HIWORD(dwRet);
	}

	BOOL GetRect(int nID, LPRECT lpRect) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETRECT, nID, (LPARAM)lpRect);
	}

	int GetTextRows() const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETTEXTROWS, 0, 0L);
	}

	BOOL SetButtonWidth(int cxMin, int cxMax)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax));
	}

	BOOL SetIndent(int nIndent)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETINDENT, nIndent, 0L);
	}

	BOOL SetMaxTextRows(int nMaxTextRows)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETMAXTEXTROWS, nMaxTextRows, 0L);
	}


#ifndef _WIN32_WCE
	BOOL GetAnchorHighlight() const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETANCHORHIGHLIGHT, 0, 0L);
	}

	BOOL SetAnchorHighlight(BOOL bEnable = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETANCHORHIGHLIGHT, bEnable, 0L);
	}
#endif // !_WIN32_WCE

	int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi);
	}

	BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi);
	}

	BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, 
	                   int iImage, WORD cx, int iCommand, DWORD_PTR lParam)
	{
		ASSERT(::IsWindow(_window));
		TBBUTTONINFO tbbi = { 0 };
		tbbi.cbSize = sizeof(TBBUTTONINFO);
		tbbi.dwMask = dwMask;
		tbbi.idCommand = iCommand;
		tbbi.iImage = iImage;
		tbbi.fsState = State;
		tbbi.fsStyle = Style;
		tbbi.cx = cx;
		tbbi.pszText = (LPTSTR) lpszItem;
		tbbi.lParam = lParam;
		return (BOOL)::SendMessage(_window, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi);
	}

#ifndef _WIN32_WCE
	int GetHotItem() const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETHOTITEM, 0, 0L);
	}

	int SetHotItem(int nItem)
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_SETHOTITEM, nItem, 0L);
	}
#endif // !_WIN32_WCE

	BOOL IsButtonHighlighted(int nButtonID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L);
	}

	DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags)
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags);
	}

#ifndef _WIN32_WCE
	BOOL GetColorScheme(LPCOLORSCHEME lpcs) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs);
	}

	void SetColorScheme(LPCOLORSCHEME lpcs)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs);
	}

	DWORD GetExtendedStyle() const
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_GETEXTENDEDSTYLE, 0, 0L);
	}

	DWORD SetExtendedStyle(DWORD dwStyle)
	{
		ASSERT(::IsWindow(_window));
		return (DWORD)::SendMessage(_window, TB_SETEXTENDEDSTYLE, 0, dwStyle);
	}

	void GetInsertMark(LPTBINSERTMARK lptbim) const
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_GETINSERTMARK, 0, (LPARAM)lptbim);
	}

	void SetInsertMark(LPTBINSERTMARK lptbim)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETINSERTMARK, 0, (LPARAM)lptbim);
	}

	COLORREF GetInsertMarkColor() const
	{
		ASSERT(::IsWindow(_window));
		return (COLORREF)::SendMessage(_window, TB_GETINSERTMARKCOLOR, 0, 0L);
	}

	COLORREF SetInsertMarkColor(COLORREF clr)
	{
		ASSERT(::IsWindow(_window));
		return (COLORREF)::SendMessage(_window, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr);
	}

	BOOL GetMaxSize(LPSIZE lpSize) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETMAXSIZE, 0, (LPARAM)lpSize);
	}

	void GetPadding(LPSIZE lpSizePadding) const
	{
		ASSERT(::IsWindow(_window));
		ASSERT(lpSizePadding != nullptr);
		DWORD dwRet = (DWORD)::SendMessage(_window, TB_GETPADDING, 0, 0L);
		lpSizePadding->cx = ((int)(short)LOWORD(dwRet));
		lpSizePadding->cy = ((int)(short)HIWORD(dwRet));
	}

	void SetPadding(int cx, int cy, LPSIZE lpSizePadding = nullptr)
	{
		ASSERT(::IsWindow(_window));
		DWORD dwRet = (DWORD)::SendMessage(_window, TB_SETPADDING, 0, MAKELPARAM(cx, cy));
		if(lpSizePadding != nullptr)
		{
			lpSizePadding->cx = ((int)(short)LOWORD(dwRet));
			lpSizePadding->cy = ((int)(short)HIWORD(dwRet));
		}
	}

	BOOL GetUnicodeFormat() const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_GETUNICODEFORMAT, 0, 0L);
	}

	BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_SETUNICODEFORMAT, bUnicode, 0L);
	}
#endif // !_WIN32_WCE
 

 
	int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString);
	}

 

	int GetString(int nString, QString& str) const
	{
		ASSERT(::IsWindow(_window));
		int nLength = (int)(short)LOWORD(::SendMessage(_window, TB_GETSTRING, MAKEWPARAM(0, nString), 0));
		if(nLength != -1)
		{
			 
			LPTSTR lpstr = str.GetBuffer(nLength+1);
			if(lpstr != nullptr)
				nLength = (int)::SendMessage(_window, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr);
			else
				nLength = -1;
			 
		}
		return nLength;
	}
 
#if( WINVER>=_WIN32_WINNT_WIN7)
	void GetMetrics(LPTBMETRICS lptbm) const
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_GETMETRICS, 0, (LPARAM)lptbm);
	}

	void SetMetrics(LPTBMETRICS lptbm)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETMETRICS, 0, (LPARAM)lptbm);
	}



	void SetWindowTheme(LPCWSTR lpstrTheme)
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme);
	}
#endif 



#if (_WIN32_WINNT >= 0x0600)
	QImageList GetPressedImageList(int nIndex = 0) const
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_GETPRESSEDIMAGELIST, nIndex, 0L));
	}

	QImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0)
	{
		ASSERT(::IsWindow(_window));
		return QImageList((HIMAGELIST)::SendMessage(_window, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList));
	}
#endif // (_WIN32_WINNT >= 0x0600)

// Operations
	BOOL EnableButton(int nID, BOOL bEnable = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0));
	}

	BOOL CheckButton(int nID, BOOL bCheck = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0));
	}

	BOOL PressButton(int nID, BOOL bPress = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0));
	}

	BOOL HideButton(int nID, BOOL bHide = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0));
	}

	BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0));
	}

	int AddBitmap(int nNumButtons, UINT nBitmapID)
	{
		ASSERT(::IsWindow(_window));
		TBADDBITMAP tbab = { 0 };
		tbab.hInst = GetModuleHandle(0);
		ASSERT(tbab.hInst != nullptr);
		tbab.nID = nBitmapID;
		return (int)::SendMessage(_window, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab);
	}

	int AddBitmap(int nNumButtons, HBITMAP hBitmap)
	{
		ASSERT(::IsWindow(_window));
		TBADDBITMAP tbab = { 0 };
		tbab.hInst = nullptr;
		tbab.nID = (UINT_PTR)hBitmap;
		return (int)::SendMessage(_window, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab);
	}

	BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons);
	}

	BOOL InsertButton(int nIndex, LPTBBUTTON lpButton)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton);
	}

	BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, 
	                  INT_PTR iString, DWORD_PTR lParam)
	{
		ASSERT(::IsWindow(_window));
		TBBUTTON tbb = { 0 };
		tbb.fsStyle = Style;
		tbb.fsState = State;
		tbb.idCommand = iCommand;
		tbb.iBitmap = iBitmap;
		tbb.iString = iString;
		tbb.dwData = lParam;
		return (BOOL)::SendMessage(_window, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb);
	}

	BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, 
	                  LPCTSTR lpszItem, DWORD_PTR lParam)
	{
		return InsertButton(nIndex, iCommand, Style, State, iBitmap, (INT_PTR)lpszItem, lParam);
	}

	BOOL AddButton(LPTBBUTTON lpButton)
	{
		return InsertButton(-1, lpButton);
	}

	BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam)
	{
		return InsertButton(-1, iCommand, Style, State, iBitmap, iString, lParam);
	}

	BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam)
	{
		return InsertButton(-1, iCommand, Style, State, iBitmap, lpszItem, lParam);
	}

	BOOL DeleteButton(int nIndex)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_DELETEBUTTON, nIndex, 0L);
	}

	UINT CommandToIndex(UINT nID) const
	{
		ASSERT(::IsWindow(_window));
		return (UINT)::SendMessage(_window, TB_COMMANDTOINDEX, nID, 0L);
	}

#ifndef _WIN32_WCE
	void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName)
	{
		ASSERT(::IsWindow(_window));
		TBSAVEPARAMS tbs = { 0 };
		tbs.hkr = hKeyRoot;
		tbs.pszSubKey = lpszSubKey;
		tbs.pszValueName = lpszValueName;
		::SendMessage(_window, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs);
	}

	void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName)
	{
		ASSERT(::IsWindow(_window));
		TBSAVEPARAMS tbs = { 0 };
		tbs.hkr = hKeyRoot;
		tbs.pszSubKey = lpszSubKey;
		tbs.pszValueName = lpszValueName;
		::SendMessage(_window, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs);
	}

	void Customize()
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_CUSTOMIZE, 0, 0L);
	}
#endif // !_WIN32_WCE

	int AddString(UINT nStringID)
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_ADDSTRING, (WPARAM)GetModuleHandle(0), (LPARAM)nStringID);
	}

	int AddStrings(LPCTSTR lpszStrings)
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_ADDSTRING, 0, (LPARAM)lpszStrings);
	}

	void AutoSize()
	{
		ASSERT(::IsWindow(_window));
		::SendMessage(_window, TB_AUTOSIZE, 0, 0L);
	}

	BOOL ChangeBitmap(int nID, int nBitmap)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0));
	}

	int LoadImages(int nBitmapID)
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_LOADIMAGES, nBitmapID, (LPARAM) GetModuleHandle(0));
	}

	int LoadStdImages(int nBitmapID)
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL);
	}

	BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb);
	}


	int HitTest(LPPOINT lpPoint) const
	{
		ASSERT(::IsWindow(_window));
		return (int)::SendMessage(_window, TB_HITTEST, 0, (LPARAM)lpPoint);
	}


	BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim);
	}

	BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const
	{
		ASSERT(::IsWindow(_window));
		POINT pt = { x, y };
		return (BOOL)::SendMessage(_window, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim);
	}

	BOOL MapAccelerator(TCHAR chAccel, int& nID) const
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID);
	}

	BOOL MarkButton(int nID, BOOL bHighlight = TRUE)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0));
	}

	BOOL MoveButton(int nOldPos, int nNewPos)
	{
		ASSERT(::IsWindow(_window));
		return (BOOL)::SendMessage(_window, TB_MOVEBUTTON, nOldPos, nNewPos);
	}

	HRESULT GetObject(REFIID iid, LPVOID* ppvObject)
	{
		ASSERT(::IsWindow(_window));
		return (HRESULT)::SendMessage(_window, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject);
	}
};



}
}//micro